%% Compute Hessian Matrix
function [H R] = computeHessianMat(data,label,Weights_old,N,D)
    Setup_parameters;
    R = zeros(N,N);
    for i = 1:N      
        yn = Sigma(data(i,:)*Weights_old);
        R(i,i) = yn*(1-yn);
    end
    H = data'*R*data;   %(N*D)'*(N*N)*(N*D)
    if(VISUALIZE_PROCESS_VARIABLES)
        figure,
        subplot(1,2,1),imshow(R);colormap(hot);
        subplot(1,2,2),imshow(H);colormap(hot);
    end
end
